package com.ruoyi.system.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import com.ruoyi.system.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BestsellersMapper;
import com.ruoyi.system.domain.Bestsellers;
import com.ruoyi.system.service.IBestsellersService;

/**
 * 热销商品配置Service业务层处理
 * 
 * @author zhang
 * @date 2025-07-15
 */
@Service
public class BestsellersServiceImpl implements IBestsellersService 
{
    @Autowired
    private BestsellersMapper bestsellersMapper;

    /**
     * 查询热销商品配置
     * 
     * @param bestsellersId 热销商品配置主键
     * @return 热销商品配置
     */
    @Override
    public Bestsellers selectBestsellersByBestsellersId(Long bestsellersId)
    {
        return bestsellersMapper.selectBestsellersByBestsellersId(bestsellersId);
    }

    /**
     * 查询热销商品配置列表
     * 
     * @param bestsellers 热销商品配置
     * @return 热销商品配置
     */
    @Override
    public List<Bestsellers> selectBestsellersList(Bestsellers bestsellers)
    {
        return bestsellersMapper.selectBestsellersList(bestsellers);
    }

    /**
     * 新增热销商品配置
     * 
     * @param bestsellers 热销商品配置
     * @return 结果
     */
    @Override
    public int insertBestsellers(Bestsellers bestsellers)
    {
        bestsellers.setBestsellersAddtime(LocalDateTime.now());
        return bestsellersMapper.insertBestsellers(bestsellers);
    }

    /**
     * 修改热销商品配置
     * 
     * @param bestsellers 热销商品配置
     * @return 结果
     */
    @Override
    public int updateBestsellers(Bestsellers bestsellers)
    {
        return bestsellersMapper.updateBestsellers(bestsellers);
    }

    /**
     * 批量删除热销商品配置
     * 
     * @param bestsellersIds 需要删除的热销商品配置主键
     * @return 结果
     */
    @Override
    public int deleteBestsellersByBestsellersIds(Long[] bestsellersIds)
    {
        return bestsellersMapper.deleteBestsellersByBestsellersIds(bestsellersIds);
    }

    /**
     * 删除热销商品配置信息
     * 
     * @param bestsellersId 热销商品配置主键
     * @return 结果
     */
    @Override
    public int deleteBestsellersByBestsellersId(Long bestsellersId)
    {
        return bestsellersMapper.deleteBestsellersByBestsellersId(bestsellersId);
    }

    @Override
    public List<Product> selectAllProducts() {
        return bestsellersMapper.selectProducts();
    }


}
